package com.bruce.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bruce.dao.RolePermissionDao;
import com.bruce.model.Permission;
import com.bruce.model.RolePermission;
import com.bruce.service.RolePermissionService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@Service
public class RolePermissionServiceImpl implements RolePermissionService {
@Autowired
	private RolePermissionDao rolePermissionDao;
	@Override
	public int insert(RolePermission impl) {
		// TODO Auto-generated method stub
		return rolePermissionDao.insert(impl);
	}

	@Override
	public int update(RolePermission impl) {
		// TODO Auto-generated method stub
		return rolePermissionDao.update(impl);
	}

	@Override
	public int delete(int rid, int pid) {
		// TODO Auto-generated method stub
		return rolePermissionDao.delete(rid,pid);
	}

	@Override
	public PageInfo<RolePermission> selectByRid(RolePermission impl, int pageNum, int pageSize) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageNum, pageSize);
		return new PageInfo<RolePermission>(rolePermissionDao.selectByRid(impl));
	}

	@Override
	public PageInfo<Permission> permissionsByRid(int rid, int pageNum, int pageSize) {
		// TODO Auto-generated method stub
		PageHelper.startPage(pageNum,pageSize);
		return new PageInfo<Permission>(rolePermissionDao.permissionsByRid(rid));
	}

	@Override
	public int deleteByRid(int rid) {
		// TODO Auto-generated method stub
		return rolePermissionDao.deleteByRid(rid);
	}

	
}
